package com.example.demo.service;

import com.example.demo.entity.Message;
import com.example.demo.mapper.MessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageImpl implements MessageService {

    @Autowired
    private MessageMapper messageMapper;

    @Override
    public void sendMessage(int sender, int receiver, String content) {
        messageMapper.sendMessage(sender, receiver, content);
    }

    @Override
    public List<Message> getMessages(int user_id, int targetUser_id) {
        return messageMapper.getMessages(user_id, targetUser_id);
    }

    @Override
    public List<Message> getConversation(Integer userId, Integer targetUserId) {
        return messageMapper.getConversation(userId, targetUserId);
    }
}